package
{
   import flash.display.Loader;
   import flash.display.Sprite;
   import flash.net.URLRequest;
   import flash.net.URLRequestMethod;
   import flash.net.URLVariables;
   import flash.system.Capabilities;
   import flash.system.Security;
   
   public dynamic class MochiBot extends Sprite
   {
       
      
      public function MochiBot()
      {
         super();
      }
      
      public static function track(parent:Sprite, tag:String) : MochiBot
      {
         if(Security.sandboxType == "localWithFile")
         {
            return null;
         }
         var self:MochiBot = new MochiBot();
         parent.addChild(self);
         Security.allowDomain("*");
         Security.allowInsecureDomain("*");
         var server:String = "http://core.mochibot.com/my/core.swf";
         var lv:URLVariables = new URLVariables();
         lv["sb"] = Security.sandboxType;
         lv["v"] = Capabilities.version;
         lv["swfid"] = tag;
         lv["mv"] = "8";
         lv["fv"] = "9";
         var url:String = self.root.loaderInfo.loaderURL;
         if(url.indexOf("http") == 0)
         {
            lv["url"] = url;
         }
         else
         {
            lv["url"] = "local";
         }
         var req:URLRequest = new URLRequest(server);
         req.contentType = "application/x-www-form-urlencoded";
         req.data = lv;
         var loader:Loader = new Loader();
         return self;
         §§push(true);
         §§push(true);
      }
   }
}
